package com.nanbei.statisticsService.controller;


import com.nanbei.commonUntil.R;
import com.nanbei.statisticsService.client.UcenterClient;
import com.nanbei.statisticsService.service.StatisticsDailyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-02-16
 */
@RestController
@RequestMapping("/statisticsService/daily")
@CrossOrigin
public class StatisticsDailyController {

    @Autowired
    private UcenterClient ucenterClient;

    @Autowired
    private StatisticsDailyService statisticsDailyService;

    /**
     * 查询每天申请的总记录数并保存
     * @param day
     * @return
     */
    @PostMapping("/registerCount/{day}")
    public R registerCount(@PathVariable String day){
        statisticsDailyService.registerCount(day);
        return R.ok();
    }

    /**
     * 查询在规定的日期内某类型的数据量
     * @param begin
     * @param end
     * @param type
     * @return
     */
    @GetMapping("showChart/{begin}/{end}/{type}")
    public R showChart(@PathVariable String begin,@PathVariable String end , @PathVariable String type){
        Map map = statisticsDailyService.showChart(begin,end,type);
        return R.ok().data(map);
    }

}

